/* 
* @Author: fangshuqin
* @Date:   2018-04-26 14:01:08
* @Last Modified by:   ZHELIHAO\fangshuqin
* @Last Modified time: 2018-05-22 15:12:34
*/

{

    class Hall extends Sail.Scene {
        constructor () {
            super();
            this.hall = null;
            this.myinfo = null;
            this.betandset = null;
            this.battle =null;
            this.tab = null;
            this.bottom = null;
            this.bg = null;

            this.init();
        }

        init() {
            this.myinfo = new Com.Hall.Myinfo();
            this.battle = new Com.Hall.Battle();
            this.tab    = new Com.Hall.Tab();
            this.bottom = new Com.Hall.Bottom();
            this.bg =  new Laya.Image("res/hall/bg.jpg");
            // this.bg .scale(2, 2);
            this.bg.centerX = 0;
            this.bg.centerY = 0;
            this.addChildren( this.bg,  Public.BetAndSet.I, this.myinfo, this.battle, this.tab, this.bottom );
            
            this.registerActions();
            Sail.io.emit(GAME_CMDS.USE_INFO);
        }

        registerActions() {
            this.ACTIONS = {
                 [GAME_CMDS.USE_INFO]  : this.getUserInfo,
            };
            Sail.io.register(this.ACTIONS, this);
        }

        getUserInfo(data) {
           Public.BetAndSet.I.getUserInfo(data); 
        }

        onExit () {
            Sail.io.unregister(this.ACTIONS);
            this.battle.exit();
            this.myinfo.exit();
        }

        onResize (width, height) {
            let rate = height / GAME_CONFIG.HEIGHT;

           /* this.tab.resize(width, height, rate);
            this.battle.resize(width, height, rate);*/
        }
    }

    Sail.class(Hall, "Scene.Hall");
}